<template>
  <div class="home">
    <!-- 面包屑 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 面包屑 -->
    <!-- 卡片区 -->
    <el-card class="mt16">
      <el-table :data="user" border style="width: 100%">
        <el-table-column fixed type="index" label="#" width="50px">
        </el-table-column>
        <el-table-column prop="authName" label="权限名称"> </el-table-column>
        <el-table-column prop="path" label="路径"> </el-table-column>
        <el-table-column prop="level" label="权限等级">
          <template slot-scope="scope">
            <el-tag v-show="scope.row.level == 0">等级一</el-tag>
            <el-tag type="success" v-show="scope.row.level == 1">等级二</el-tag>
            <el-tag type="danger" v-show="scope.row.level == 2">等级三</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import { getrights } from '@/http/api.js'
export default {
  data() {
    return {
      user: [] //这是存放数据的
    }
  },
  created() {
    this.getlist()
  },
  methods: {
    //   渲染数据
    async getlist() {
      const res = await getrights()
      console.log('rights', res)
      this.user = res
    }
  }
}
</script>

<style lang="scss" scoped>
.home {
  width: 100%;
  box-sizing: border-box;
}
</style>
